LET LENGTH = 9
DIM MYDATA( 1 TO LENGTH )

Answer:

The array is of length 9; it has slots numbered 1, 2, 3, ..., 8, 9

Array Length as a Variable

In this program snippet the length of the array is contained in a variable. This is perfectly fine. Here is a more extensive program:

LET LENGTH = 9
DIM MYDATA( 1 TO LENGTH )
FOR COUNT = 1 TO LENGTH
  LET MYDATA( COUNT ) = 48.23
NEXT COUNT
END

Notice how the LENGTH of the array is used in several places, but only given an explicit value (9) in one place.

(If you type this program into QBasic, be sure to say MYDATA and not DATA because the latter has a special meaning to the system.)

QUESTION 7:

Make just ONE change in the program so that the array is of length 21, and the rest of the program works correctly.